__author__="Kamo"
__date__ ="$02.08.2010 14:50:43$"

import os, sys
from sitemapgen.generator import Generator
if __name__ == "__main__":
	file_type = "text"
	gzip_it = False
	if len(sys.argv) > 2:
		for command in sys.argv:
			if command.startswith("-o="):
				output = command[3:]
			else:
				if command.startswith("-f="):
					file_type = command[3:]
				else:
					if command.startswith("-g="):
						if command[3:] == "y":
							gzip_it = True
					else:
						url = command
		gen = Generator(url)
		if file_type == "text":
			gen.create_txt(output)
		if file_type == "xml":
			gen.create_xml(output)
		if file_type == "html":
			gen.create_html(output)

		if gzip_it:
			gen.gzip_file(output)

	else:
		print "USAGE"
		print "[python] index.py -o=<output.ext> [-f=text|xml|html] <site_address> [-g=y|n]"
